import request from '@/utils/request'

const menuApi = {
  lists: '/api/v2/users'
}

export function getUsersLists (paramter) {
  return request({
    url: menuApi.lists,
    method: 'get',
    params: paramter
  })
}

export function getUserBatteryList (id) {
  return request({
    url: menuApi.lists + '/' + id + '/batteries/',
    method: 'get'
  })
}

export function deleteUserBattery (userId, batteryId) {
  return request({
    url: menuApi.lists + '/' + userId + '/batteries/' + batteryId,
    method: 'delete'
  })
}

export function putUserBattery (userId, batteryId) {
  return request({
    url: menuApi.lists + '/' + userId + '/batteries/' + batteryId,
    method: 'put'
  })
}

export function deleteUser (id) {
  return request({
    url: menuApi.lists + '/' + id,
    method: 'delete'
  })
}

export function updateUser (id, data) {
  return request({
    url: menuApi.lists + '/' + id,
    method: 'put',
    data: data
  })
}
